<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>员工更新 - 领导日程说明系统</title>
    <meta th:replace="~{include/all_include ::  title}"/>
    <link
            th:href="@{/common/resource/H-ui.admin/static/h-ui.admin/css/H-ui.login.css}"
            rel="stylesheet" type="text/css" />
    <link th:href="@{/common/resource/H-ui.admin/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css}" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .ztree li span.button.firstPage {float:right; margin-left:2px; margin-right: 0; background-position:-144px -16px; vertical-align:top; *vertical-align:middle}
        .ztree li span.button.prevPage {float:right; margin-left:2px; margin-right: 0; background-position:-144px -48px; vertical-align:top; *vertical-align:middle}
        .ztree li span.button.nextPage {float:right; margin-left:2px; margin-right: 0; background-position:-144px -64px; vertical-align:top; *vertical-align:middle}
        .ztree li span.button.lastPage {float:right; margin-left:2px; margin-right: 0; background-position:-144px -32px; vertical-align:top; *vertical-align:middle}
        ul.ztree {margin-top: 10px;border: 1px solid #617775;background: #f0f6e4;width:220px;height:360px;overflow-y:scroll;overflow-x:auto;}
    </style>
    <meta name="keywords" content="领导日程说明系统-登录">
    <meta name="description" content="领导日程说明系统-登录">
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span>用户模块
    <span class="c-gray en">&gt;</span> 员工更新
    <a class="btn btn-success radius r" style="line-height: 1.6em; margin-top: 3px"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>
<article class="page-container">
    <form class="form form-horizontal" id="form-article-add"
          enctype="multipart/form-data"
          th:action="@{/back/users/usersDescInsertSubmit}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>组织：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="hidden" class="input-text" th:value="${one?.organId }" placeholder=""
                       id="organId" name="entity.organId">
                <input type="text" class="input-text" th:value="${one?.organObj?.name }" placeholder=""
                       id="organIdVal" onclick="showMenu();" readonly>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>用户名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${one?.email }" placeholder=""
                       id="email" name="entity.email">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>昵称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${one?.nickName }" placeholder=""
                       id="nickName" name="entity.nickName">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>姓名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${one?.name }" placeholder=""
                       id="name" name="entity.name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>身份证：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${one?.idCard }" placeholder=""
                       id="idCard" name="entity.idCard">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>手机：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${one?.phone }" placeholder=""
                       id="phone" name="entity.phone">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>qq：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${one?.qq }" placeholder=""
                       id="qq" name="entity.qq">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>微信：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${one?.weChat }" placeholder=""
                       id="weChat" name="entity.weChat">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>入职时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  readonly="readonly" th:value="${#dates.format(one.empTime,'yyyy-MM-dd')}"
                       onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                       id="empTime" name="empTime">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>参加工作时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"  readonly="readonly" th:value="${#dates.format(one.joinJobTime,'yyyy-MM-dd')}"
                       onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                       id="joinJobTime" name="joinJobTime">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">内容：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <script name="entity.content" id="editor" type="text/plain" style="width:100%;height:400px;"></script>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
        <div id="menuContent" class="menuContent" style="display:none; position: absolute;">
            <ul id="treeDemo" class="ztree" style="margin-top:0; width:180px; height: 300px;"></ul>
        </div>
        <div id="rootNode" th:text="${dataList}" style="display: none"></div>
    </form>
</article>
<footer th:replace="~{include/all_include ::  footer}"/>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" th:src="@{/common/resource/H-ui.admin/lib/My97DatePicker/4.8/WdatePicker.js}"></script>
<script type="text/javascript" th:src="@{/common/resource/H-ui.admin/lib/jquery.validation/1.14.0/jquery.validate.js}"></script>
<script type="text/javascript" th:src="@{/common/resource/H-ui.admin/lib/jquery.validation/1.14.0/validate-methods.js}"></script>
<script type="text/javascript" th:src="@{/common/resource/H-ui.admin/lib/jquery.validation/1.14.0/messages_zh.js}"></script>
<script type="text/javascript" th:src="@{/common/resource/H-ui.admin/lib/webuploader/0.1.5/webuploader.min.js}"></script>
<script type="text/javascript" th:src="@{/common/resource/H-ui.admin/lib/ueditor/1.4.3/ueditor.config.js}"></script>
<script type="text/javascript" th:src="@{/common/resource/H-ui.admin/lib/ueditor/1.4.3/ueditor.all.min.js}"> </script>
<script type="text/javascript" th:src="@{/common/resource/H-ui.admin/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js}"></script>
<script type="text/javascript" th:src="@{/common/resource/H-ui.admin/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js}"></script>
<script type="text/javascript" th:inline="javascript">
    var setting = {
        check: {
            enable: true,
            chkStyle: "radio",
            radioType: "all"
        },
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable:true,
                idKey: "id",
                pIdKey: "parentId",
                rootPId: ""
            }
        },
        callback: {
            onClick: onClick,
            onCheck: onCheck
        }
    };

    var zNodes = JSON.parse($("#rootNode").html());

    function onClick(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo");
        zTree.checkNode(treeNode, !treeNode.checked, null, true);
        return false;
    }

    function onCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
            nodes = zTree.getCheckedNodes(true),
            v = "";
        currId = "";
        for (var i=0, l=nodes.length; i<l; i++) {
            v += nodes[i].name + ",";
            currId += nodes[i].id;
        }
        if (v.length > 0 ) v = v.substring(0, v.length-1);
        var cityObj = $("#organIdVal");
        cityObj.attr("value", v);
        console.info("======")
        $("#organId").val(currId);
    }

    function showMenu() {
        var cityObj = $("#organIdVal");
        var cityOffset = $("#organIdVal").offset();
        $("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

        $("body").bind("mousedown", onBodyDown);
    }
    function hideMenu() {
        $("#menuContent").fadeOut("fast");
        $("body").unbind("mousedown", onBodyDown);
    }
    function onBodyDown(event) {
        if (!(event.target.id == "menuBtn" || event.target.id == "citySel" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
            hideMenu();
        }
    }

    $(function(){
        $.fn.zTree.init($("#treeDemo"), setting, zNodes);
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        //表单验证
        $("#form-article-add").validate({
            rules:{
                name:{
                    required:true,
                },
                capital:{
                    required:true,
                    minlength:4,
                    maxlength:50
                },
                stYear:{
                    required:true,
                },
                edYear:{
                    required:true,
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    type: 'post',
                    success: function(data){
                        console.log("==data==",data)
                        data = JSON.parse(data);
                        layer.msg(data.info,{icon:1,time:3000},function(){
                            /* 关闭当前窗口 */
                            if (data.code == '0') {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.$('.btn-refresh').click();
                                parent.layer.close(index);
                            }
                        });
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer.msg('error!',{icon:1,time:1000});
                    }
                });
            }
        });

        var ue = UE.getEditor('editor');
        var content = [[${one?.content}]];
        /* 百度编辑器提供的方法 */
        ue.addListener("ready", function () {
            /* 为百度编辑器赋值 */
            ue.setContent(content);
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>